Structures (Cont.)
Pascal
C/C++
w
var
w
borrower: record
w
case boolean of
w
false: (EBorr: emploee);
w
true: (SBorr: student)
w
end;
w
union
w
{
emploee EBorr;
w
student SBorr;
w
} borrower;
EXAMPLE
:
Suppose the types employee and student have
been previously declared:
Note: there is no provision for an explicit tag field in C unions, analogous to the tag field of a Pascal variant record.